package com.pengshun.modules.api.user.service.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pengshun.modules.api.coal.validator.Fifth;
import com.pengshun.modules.api.coal.validator.First;
import com.pengshun.modules.api.coal.validator.Second;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 消息通知
 * @author luoligang
 * @create 2021/3/12
 */
@Data
public class SystemMessageDto {

    @NotNull(message = "type不能为空", groups = {Second.class})
    private Long systemMessageId;

    /**  消息类型 */
    @NotNull(message = "type不能为空", groups = {Fifth.class})
    private Integer type;

    /** 通知用户id  */
    private Long userId;

    /** 标题  */
    private String title;

    /** 通知内容  */
    private String content;

    /** 0未读 1已读  */
    private Integer imRead;
    private String imageUrl;
    private String remark;
    private Integer messageNum;

    /**    */
    @NotNull(message = "id不能为空", groups = {Fifth.class})
    private Long id;

    /** 创建时间  */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private Date createTime;

    /** 类别id   */
    @NotNull(message = "categoryId不能为空", groups = {First.class})
    private Integer categoryId;

    /**  类别名称 */
    private String categoryName;
    @NotNull(message = "page不能为空", groups = {First.class})
    private int  page;
    @NotNull(message = "size不能为空", groups = {First.class})
    private int size;
    public Integer getPage() {
        int pg=this.page*this.size;
        return pg;
    }
}
